package cinvestav.adviseme.controller;

import java.sql.Date;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;

import cinvestav.adviseme.databasemodel.IPersonaDB;
import cinvestav.adviseme.databasemodel.PersonaDB;
import cinvestav.adviseme.datamodel.Lugar;
import cinvestav.adviseme.datamodel.Persona;
import cinvestav.adviseme.util.DBException;

public class PersonaController implements IPersonaController{

	protected IPersonaDB personaDB;
	
	public PersonaController() throws DBException {
		personaDB = new PersonaDB();
	}

	@Override
	public IPersonaDB getPersonaDB() {
		return personaDB;
	}

	@Override
	public void setPersonaDB(IPersonaDB personaDB) {
		this.personaDB = personaDB;
		
	}

	/**
	 * Obtiene la lista de todas las personas almacenadas en la base de datos
	 * @return Lista de Personas
	 */
	@Override
	public List<Persona> getAll() throws DBException {
		return personaDB.getAll();
	}

	@Override
	public List<Persona> getByFilters(Map<String, String[]> filtros)
			throws DBException {
		// TODO Auto-generated method stub
		return personaDB.getByFiter(filtros);
	}

	@Override
	public Boolean delete(Persona persona) throws DBException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Boolean insert(Persona persona) throws DBException {
		// TODO Auto-generated method stub
		return personaDB.insert(persona);
	}

	@Override
	public List<Persona> getFriends(Persona persona) throws DBException {
		return personaDB.getFriends(persona);
	}

	@Override
	public List<Persona> getFriendsByFilters(Persona persona,
			Map<String, String[]> filtros) throws DBException {
		return personaDB.getFriendsByFilter(persona, filtros);
	}
	
	@Override
	public Boolean deleteFriendShip(Persona personaOrigen, Persona personaDestino) throws DBException{
		return personaDB.deleteFriendShip(personaOrigen,personaDestino);		
	}

}
